package com.idstrust.wiseone.sg.wisehr.common.conf;

import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;

public class LoadConfig {
	
	public String schema;
	private static LoadConfig instance;
	private String confPath = "C:/wiseOneIDE_3.0/javaWorkspaces/wiseOne3.0/com.idstrust.wiseone.sg.wisehr/bin/com/idstrust/wiseone/sg/wisehr/common/conf/Config.properties";
	//private String confPath = "d:/wiseone/batch/Config.properties";
	
	private LoadConfig(){}
	
	/**
	 * Singleton
	 * @return
	 */
	public static LoadConfig getInstance(){
		if(instance == null){
			instance = new LoadConfig();
			instance.loadConf();
		}
		return instance;
	}

	/**
	 * LoadConf
	 * @return
	 */
	public void loadConf(){
		Properties props = new Properties();
		try {
			InputStream inStream = new FileInputStream(confPath);
	        props.load(inStream);
	    } catch (Exception e) {
	        e.printStackTrace();
	    }
	    setProperty(props);	
	}
	
	/**
	 * Config
	 * @param props
	 */
	public void setProperty(Properties props){
		this.schema = props.getProperty("hr.comp.code");
	}

}
